package com.ydgk.Test;

import com.ydgk.bean.Provider;
import com.ydgk.dao.ProviderDao;
import org.junit.Before;
import org.junit.Test;

public class ProviderDaoTest {
    protected ProviderDao providerDao;
    @Before
    public void init(){
        providerDao=new ProviderDao();
    }

    @Test
    public void updateMoneyTest(){
        Provider provider=providerDao.findById(1);
        System.out.println(providerDao.updateMoney(provider,100));
    }

    @Test
    public void findById(){
        System.out.println(providerDao.findById(1));
    }

    @Test
    public void saveTest(){
        Provider provider = new Provider();
        provider.setPname("大米");
        provider.setPhone(123);
        provider.setPmoney(120);
        provider.setAddress("wuhan");
        provider.setPeople("小雷军");
        System.out.println(
        providerDao.save(provider));
    }

    @Test
    public void updateByIdTest(){
        Provider provider = new Provider();
        provider.setPid(31);
        provider.setPhone(6666666);
        provider.setPname("万科");
        provider.setPeople("牛云");
        System.out.println(providerDao.updateById(provider));
    }

    @Test
    public void deleteById(){
        System.out.println(providerDao.deleteById(33));
    }
}
